<%@ page contentType="text/html; charset=UTF-8" language="java" import="java.util.*,com.pub.database.*" %>
<%
  com.pub.database.QueryBean qbnDAO=null;
  StringBuffer lstbSQL=new StringBuffer();
  ArrayList<ArrayList<Object>> aryRowData=null;
  ArrayList<Object> aryData=null;

  try{
    qbnDAO=new com.pub.database.QueryBean(request.getParameter("DB_ALIAS"),Boolean.parseBoolean(request.getParameter("DEBUG")),"big5","big5");

    /*等pnl_work建好再改回用這段sql
    lstbSQL.append("select pnl_employee.employee_no,pnl_employee.employee_name_c,initcap(pnl_employee.employee_name_e),");
    lstbSQL.append("bas_dept.dept_no,bas_dept.dept_name,pnl_employee.fact_no,pnl_employee.class_code,pnl_work.class_name,");
    lstbSQL.append("(select max(employee_tel) from pnl_tel where employee_no=pnl_employee.employee_no)");

    lstbSQL.append(" from pnl_employee left outer join pnl_work on pnl_employee.class_code=pnl_work.class_code,bas_dept");
    lstbSQL.append(" where pnl_employee.dept_no=bas_dept.dept_no");
    lstbSQL.append(" and pnl_employee.employee_st='A'");
    lstbSQL.append(" and pnl_employee.employee_no='");
    lstbSQL.append(request.getParameter("empno"));
    lstbSQL.append("'");*/
    
    lstbSQL.append("select pnl_employee.employee_no,pnl_employee.employee_name_c,pnl_employee.employee_name_e,");
    lstbSQL.append("bas_dept.dept_no,bas_dept.dept_name,pnl_employee.fact_no,pnl_employee.class_code,");
    lstbSQL.append("(select max(employee_tel) from pnl_tel where employee_no=pnl_employee.employee_no)");
    lstbSQL.append(" from pnl_employee,bas_dept");
    lstbSQL.append(" where pnl_employee.dept_no=bas_dept.dept_no");
    lstbSQL.append(" and pnl_employee.employee_st='A'");
    lstbSQL.append(" and pnl_employee.employee_no='");
    lstbSQL.append(request.getParameter("empno"));
    lstbSQL.append("'");

    aryRowData=qbnDAO.querySQL(lstbSQL.toString());

    if(aryRowData!=null){
      aryData=(ArrayList<Object>)aryRowData.get(0);
      out.println(aryData.toString().substring(1,aryData.toString().length()-1));
    }
    else{
      out.println("null");
    }
  }
  catch(Exception e){
    e.printStackTrace();
  }
  finally{
    if(qbnDAO!=null){
      try{qbnDAO.close();}catch(Exception se){se.printStackTrace();}
    }
    if(aryRowData!=null){
    	aryRowData.clear();
    	aryRowData=null;
      }
    if(aryData!=null){
      aryData.clear();
      aryData=null;
    }
    lstbSQL=null;
  }
%>
